package com.spring_mysql_redis.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spring_mysql_redis.entity.Message;
import com.spring_mysql_redis.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "消息管理")
@RestController
@RequestMapping("/message")
public class MessageController {

    private Logger logger = LoggerFactory.getLogger(MessageController.class);

    @Autowired
    private MessageService messageService;

    /**
     * 查询未读消息列表信息
     *
     * @return
     */
    @ApiOperation("查询未读消息列表接口")
    @GetMapping("/list")
    public Page<Message> pgUnreadList(@RequestParam("uuId") String uuId) {
        logger.info("-------------------查询未读消息列表controller层--------------------------");
        return messageService.selectMessageList(uuId);
    }
}
